Skip to content

gh-153537: Fix Element re-init memory leak in the C accelerator#153538

Open
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:elementtree-reinit-extra-leak
Open

gh-153537: Fix Element re-init memory leak in the C accelerator#153538
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:elementtree-reinit-extra-leak

Conversation

@tonghuaroot

Copy link
Copy Markdown
Contributor

Element.__init__ in the C accelerator leaked the element's previous children and attributes when called more than once, because create_extra allocated a new extra without freeing the old one. Clear it first, so re-initialization now discards the previous children and attributes like the pure-Python implementation.

element_init allocated a new extra without releasing the previous one,
leaking the element's children and attributes on a second __init__ call.
Clear the old extra first, so re-init discards the previous children and
attributes, matching the pure-Python implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant